package com.nba.service.impl;

import com.nba.bean.Admin;
import com.nba.dao.AdminDao;
import com.nba.dao.impl.AdminDaoImpl;
import com.nba.service.AdminService;

public class AdminServiceImpl implements AdminService {
	
	private AdminDao admindao = new AdminDaoImpl();
	@Override
	public int loginAdmin(String adminName, String password) {
		Admin admin = admindao.selectAdmin(adminName, password);
		if ( admin != null) {
			return 1;
		}else {
			Admin admin1 = admindao.selectAdmin(adminName);
			if(admin1 != null) {
					return -1;
			}else {
				return 0;
			}
		}
	}
	@Override
	public int addAdmin(String adminName, String password) {
		return admindao.insertAdmin(adminName, password);
	}
	@Override
	public int selectAdmin(String adminName) {
		Admin admin = admindao.selectAdmin(adminName);
		if(admin != null) {
			return 1;
		}else {
			return -1;
		}
	}

}
